<?php

use App\Http\Controllers\Common\CommonController;
use App\Http\Controllers\Common\ConfigController;
use App\Http\Controllers\Common\PreviewController;
use App\Http\Controllers\OpenShop\Feishu\OrganizationManageController;
use App\Http\Middleware\Common\VerifySignature;
use App\Http\Middleware\OpenShop\MerchantAppAuth;
use Illuminate\Support\Facades\Route;

Route::get('file/upload', 'FileController@index')->middleware('rms.backend');
Route::post('file/upload', 'FileController@upload');
Route::get('file/getUploadAccess', 'FileController@getUploadAccess');
Route::get('file/getSTSAccessInfo', 'FileController@getSTSAccessInfo');
Route::post('url/addUrl', 'ShortUrlController@generateShortUrl');
Route::get('url/index', 'ShortUrlController@index')->middleware('rms.backend');
Route::get('t/{code}', 'ShortUrlController@getShortUrl');


//商家APP消息简单推送
Route::post('information/appPush', 'InformationController@appBasePush');

// 修改config
Route::post('config/save', [ConfigController::class, 'save'])
     ->middleware([\App\Http\Middleware\OpenShop\FeishuWebAuth::class]);

Route::get('amap/district', [ConfigController::class, 'getAmapDistrict']);

// 夸父选址省市区和code匹配规范 https://onepiece-group.feishu.cn/wiki/FA9EwrlZYikHy3kZ4tTcJ917npe
Route::get('amap/regionMatchSpecs', [ConfigController::class, 'regionMatchSpecs']);

Route::get('amap/getWeatherByAdCode', [ConfigController::class, 'getWeatherByAdCode']);


Route::prefix('merchant')->middleware(MerchantAppAuth::class)->group(function () {
    //设备推送信息绑定
    Route::post('devicePushBind', [CommonController::class, "devicePushBind"]);

    // app切换门店后，相关配置获取
    Route::get('configByShopId', [CommonController::class, 'configByShopId']);
});

Route::middleware([VerifySignature::class])->group(function () {
    Route::prefix("preview")->group(function () {
        //预览资源获取列表
        Route::post("resourceLists", [PreviewController::class, "resourceLists"]);
    });
});

// 快递查询接口
Route::get('logisticsQuery', [CommonController::class, 'logisticsQuery']);


// appCrash上报
Route::prefix("appCrash")->group(function () {
    Route::post("upload", [\App\Http\Controllers\Common\AppCrashController::class, "upload"]);
});

Route::prefix('config')->group(function () {
    Route::get('public', [ConfigController::class, 'publicConfig']);
});


// 判断日期是否是工作日
Route::get('isWorkDayTime', [CommonController::class, 'isWorkDayTime']);


// 返回随机的高德key-web端(JS API)
Route::post('getAmapWebJsApi', [CommonController::class, 'getAmapWebJsApi']);
